import { createRouter, createWebHistory } from 'vue-router';
import UserList from '@/views/User/UserList.vue';
import UserAdd from '@/views/User/UserAdd.vue';
import UserEdit from '@/views/User/UserEdit.vue';

import DeviceList from '@/views/Device/DeviceList.vue';
import DeviceAdd from '@/views/Device/DeviceAdd.vue';
import DeviceEdit from '@/views/Device/DeviceEdit.vue';

import SensorDataList from '@/views/SensorData/SensorDataList.vue';

const routes = [
  { path: '/users', component: UserList },
  { path: '/users/add', component: UserAdd },
  { path: '/users/edit/:id', component: UserEdit },

  { path: '/devices', component: DeviceList },
  { path: '/devices/add', component: DeviceAdd },
  { path: '/devices/edit/:id', component: DeviceEdit },

  { path: '/sensor-data', component: SensorDataList },
  { path: '/', redirect: '/users' }, // 默认重定向到用户列表
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;